In the case of Microservices the business logic of an application is spread over multiple microservices.
In the case of a simple request, the request may be addressed via a single microservices. However, in the case of complex requests, the request will need to be handled by multiple services with one service calling another. Cross-services communications need to be carefully handled and addressed.
Lots of aspects need to be considered while developing complex business logic especially in the case of microservice architecture. In the case of complex requests, where multiple services are called, a saga pattern is required to ensure data consistency across multiple services. The business logic will need to generate events when the data changes. There is a clear need to structure the business logic depending on whether the scenario is simple or complex.
For simple scenarios, it is better to choose the transaction script pattern itself instead of using an object-oriented approach.
In the case of a transaction script pattern, a method called ‘transaction script’ is written to handle each request from the presentation layer. The classes implementing behavior will need to be separate from that the classes which store the state.
In the case of complex business logic, Domain-driven design (DDD) is preferred. DDD is useful to decompose an application into multiple services. In the case of DDD, each service has its domain model instead of a single application-wide domain model. Subdomains and Bounded context are two of the strategic Domain-driven design patterns.
While decomposing an application into services, one common pitfall to avoid is to not group related activities into one service. Grouping should be done based on domain and not based on entity.
Posted Date:- 2021-11-27 09:03:13
What is Domain Driven Design (DDD)? How is it used in Microservices?
What is Eureka in Microservices?
Why do Microservices require a DevOps approach??
What is a bounded context in microservices?
What is the purpose of Netflix Zuul?
What is the Service Discovery pattern in microservices?
What is a Log aggregator pattern in Microservices?
What is polyglot architecture in Microservices?
What is the CDC pattern in microservices?
How to deploy microservices in java?
What tools can be used for monitoring microservices?
What is feign client in microservices?
What are the most common mistakes while transitioning to Microservices?
Which acts as a database of services in microservices?
How are the problems with distributed transactions addressed in microservices?
What is the difference between the anonymous class and Lambda function?
What are the use cases for which Lambda was actually designed?
What are the Final Variables and Effectively final variables in Lambda?
What is a circuit breaker pattern in Microservices?
What is the CQRS pattern in microservice??
What do you know about Lambda Expression?
What are the various design patterns used in microservices?
What is a saga pattern in microservices?
What is SQS in Lambda? What role does it play?
What do you know about Configuration Management?
Is vertical scaling possible in Lambda?
What are the disadvantages of microservices?
Efficient utilization & fast deployment represent which pattern in microservices?
How to deploy microservices in docker?
What are the main components of Microservices architecture?
What are the caching types in microservices?
How to implement microservices in java?
What do you know about building an AMI?
What are the main features of Microservices?
Why are containers a good infrastructure for microservices?
What are microservices in spring boot?
What is event-driven communication in microservices?
What is API gateway in microservices?
What is Microservices Architecture?
What are microservices in .net?
How does a microservices design complicate business logic?
Give a simple method to improve performance in AWS Lambda?